package com.neu.questionnaireplus.config.service;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.TransactionManagementConfigurer;

import javax.sql.DataSource;

@Configuration
@EnableTransactionManagement
public class TransactionManageConfig implements TransactionManagementConfigurer {

  @Autowired
  private DataSource dataSource;

  /** 
  * @Description: 事务管理者配置 
  * @Param: [] 
  * @return: org.springframework.transaction.PlatformTransactionManager 
  * @Author: ~FHX~ (:TSunS:)
  * @Date: 2022/10/26 
  */ 
  @Override
  public PlatformTransactionManager annotationDrivenTransactionManager() {
    return new DataSourceTransactionManager(dataSource);
  }

}

